#ifndef _TIMESLICE_H
#define _TIMESLICE_H

#include "list.h"

#define NAME_LEN      (32)

typedef enum {
    TASK_STOP,
    TASK_RUN
} IsTaskRun;

typedef struct timesilce
{
    unsigned int id;
    char task_name[NAME_LEN];
    void (*task_hdl)(void);
    IsTaskRun is_run;
    unsigned int timer;
    unsigned int time_interval;
    ListObj timeslice_task_list; 
} TimesilceTaskObj;

void timeslice_exec(void);
void timeslice_tick(void);
void timeslice_task_init(TimesilceTaskObj* obj, void (*task_hdl)(void), unsigned int id, const char *task_name, unsigned int time_interval);
void timeslice_task_add(TimesilceTaskObj* obj);
void timeslice_task_del(TimesilceTaskObj* obj);
unsigned int timeslice_get_task_time_interval(TimesilceTaskObj* obj);
unsigned int timeslice_get_task_num(void);
void timeslice_print_all_tasks_name(void);
unsigned char timeslice_task_isexist(TimesilceTaskObj* obj);
unsigned int timeslice_get_task_id(TimesilceTaskObj* obj);
char *timeslice_get_task_name(TimesilceTaskObj* obj);
unsigned char timeslice_get_task_status(TimesilceTaskObj* obj);
unsigned int timeslice_get_task_timer_left(TimesilceTaskObj* obj);

#endif
